<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function arr(day, month, year) {
      const str = [year, month, day].join('/')
      const weeks = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
      return weeks[new Date(str).getDay()]
    };
    console.log(arr(day = 31, month = 8, year = 2019));
  </script>
</body>

</html>